-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow customization of application name in the generated title #13
allow customization of application name in the generated title #13
Conversation
This update fixes the `Style/SuperArgument` error from `standardrb`
This update allows users to now pass a custom name instead of using the default value, i.e., the application from `Rails.application.name`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this!
Great addition. I have some feedback.
lib/plutonium/core/controller.rb
Outdated
@@ -29,8 +29,8 @@ def set_page_title(page_title) | |||
@page_title = page_title | |||
end | |||
|
|||
def make_page_title(title) | |||
[title.presence, helpers.application_name].compact.join(" | ") | |||
def make_page_title(title, app_name: helpers.application_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add an app_name
method that defaults to helpers.application_name
and remove the app_name
param from make_page_title
altogether.
def make_page_title(title)
[title.presence, app_name].compact.join(" | ")
end
def app_name
helpers.application_name
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is much cleaner. We should have this instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic! Thanks.
make_page_title
to Accept An Optional app_name
Parameter
This pull request includes changes to improve the flexibility and functionality of methods in the
lib/plutonium
directory. The most important changes include modifying themake_page_title
method to accept an optionalapp_name
parameter and simplifying thesubmit_button
method by removing redundant parameters.Improvements to method parameters:
lib/plutonium/core/controller.rb
: Modified themake_page_title
method to accept an optionalapp_name
parameter, allowing more flexibility in setting the page title.Code simplification:
lib/plutonium/ui/form/interaction.rb
: Simplified thesubmit_button
method by removing redundant parameters, making the code cleaner and easier to maintain.